Add BadSuccessor dMSA Privilege Escalation in Windows 2025 #20472
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a new module which exploits "Bad Successor", which allows operators to elevate privileges on domain controllers running at the Windows 2025 forest functional level. Microsoft decided to introduce Delegated Managed Service Accounts in this forest level and they came ripe for exploitation.
Normal users can't create dMSA accounts where dMSA accounts are suppoed to be created, the Managed Service Accounts OU, but if a normal user has write access to any other OU they can then create a dMSA account in said OU. After creating the account the user can edit LDAP attributes of the account to indicate that this account should inherit privileges from the Administrator user. Once this is complete we can request kerberos tickets on behalf of the dMSA account and voilà, you're admin.
Action: CREATE_DMSA
CREATE_DMSAcreates a dMSA account and configure it to be vulnerable to Bad Successor.When the account is created the
msds-groupmsamembershipattribute is set to an nt security descriptor which allows the user the operator is authenticated with, to retrieve the password of the dMSA account.After the account is created two attributes on the dMSA are updated:
msds-managedaccountprecededbylinkis set to the DN of the account you wish to impersonate andmsds-delegatedmsastateis set to2which indicates the dMSA account migration is complete. It is necessary to first create the account and then afterwards update these attributes.Action: GET_TICKET
GET_TICKETgets a TGT of the user that created the dMSA and has access to retrieve it's password. Then requests a TGT on behalf of the dMSA account with the previous TGT. Then using that TGT requests a TGS for a specific service (defaults to cifs) on the domain controllerThis PR make changes to the
get_ticketmodule and then subsequent libraries it calls in order impersonate the dMSA account and also dump theDMSA_KEY_PACKAGE(more here) during the authentication process.Testing
Check Method
Create dMSA
Get Ticket
Use ticket to connect to ADMIN$ share
TODOs
msfusercreated a new dMSAmsfuserwas granted Full Control of the object. This won't always be the case. In some scenariosmsfuserwill only be granted Owner and in turn WriteDacl in which case we need to update the security descriptor to allowmsfuserto editmsds-managedaccountprecededbylinkandmsds-delegatedmsastate